<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="CreateNew.aspx.vb" Inherits="GTSWeb_Shipment_Manage" title="GTS Frieght Management System"  MaintainScrollPositionOnPostback="true" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder" Runat="Server">
    <h3>Active Shipments</h3>
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
        CellPadding="4" DataKeyNames="ReferenceNumber" DataSourceID="ShipmentsDataSource"
        ForeColor="#333333" GridLines="None" PageSize="4" Width="100%" AllowPaging="True">
        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <Columns>
            <asp:TemplateField HeaderText="Date" SortExpression="ShipmentDate">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("ShipmentDate") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label3" runat="server" Text='<%# Bind("ShipmentDate", "{0:yyyy/MM/dd}") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" />
            <asp:BoundField DataField="NrOfPieces" HeaderText="Pieces" SortExpression="NrOfPieces" />
            <asp:TemplateField HeaderText="Status" SortExpression="StatusID">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("StatusID") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:DropDownList ID="DropDownList2" runat="server" DataSourceID="StatusSource" DataTextField="StatusName"
                        DataValueField="StatusID" SelectedValue='<%# Bind("StatusID") %>'>
                    </asp:DropDownList><asp:ObjectDataSource ID="StatusSource" runat="server" OldValuesParameterFormatString="{0}"
                        SelectMethod="getStatus" TypeName="GTSSystem.BLL.Status"></asp:ObjectDataSource>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="ShipmentNumber" HeaderText="Shipment Number" SortExpression="ShipmentNumber" />
            <asp:HyperLinkField DataNavigateUrlFields="ReferenceNumber" DataNavigateUrlFormatString="~/GTSWeb/Shipment/AddItems.aspx?ReferenceNumber={0}"
                Text="Add items" />
            <asp:HyperLinkField DataNavigateUrlFields="ReferenceNumber" DataNavigateUrlFormatString="~/GTSWeb/Shipment/CalculateRates.aspx?ReferenceNumber={0}"
                Text="Calculate Rates" />

   
        </Columns>
        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" HorizontalAlign="Center" />
        <EditRowStyle BackColor="#999999" />
        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
    </asp:GridView>
    <asp:ObjectDataSource ID="ShipmentsDataSource" runat="server" OldValuesParameterFormatString="{0}"
        SelectMethod="getAllActiveShipments" TypeName="GTSSystem.BLL.Shipment" InsertMethod="CreateShipment" UpdateMethod="getAllActiveShipments">
        <SelectParameters>
            <asp:ProfileParameter Name="BranchID" PropertyName="BranchId" Type="Int32" />
        </SelectParameters>
        <UpdateParameters>
            <asp:Parameter Name="BranchID" Type="Int32" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="Shipmentdate" Type="DateTime" />
            <asp:Parameter Name="ClientId" Type="Int32" />
            <asp:Parameter Name="ClientBranchid" Type="Int32" />
            <asp:Parameter Name="CarrierId" Type="Int32" />
            <asp:Parameter Name="Weight" Type="Double" />
            <asp:Parameter Name="Origin" Type="Int32" />
            <asp:Parameter Name="Destination" Type="Int32" />
            <asp:Parameter Name="ServicetTypeId" Type="Int32" />
            <asp:Parameter Name="Description" Type="String" />
            <asp:Parameter Name="GST" Type="Double" />
            <asp:Parameter Name="PST" Type="Double" />
            <asp:Parameter Name="HST" Type="Double" />
            <asp:Parameter Name="Surcharge" Type="Double" />
            <asp:Parameter Name="TotalPieces" Type="Int32" />
            <asp:Parameter Name="UserName" Type="String" />
            <asp:Parameter Name="StatusId" Type="Int32" />
            <asp:Parameter Name="Address" Type="String" />
            <asp:Parameter Name="PostalCodes" Type="String" />
            <asp:Parameter Name="ShipmentNumber" Type="Int32" />
        </InsertParameters>
    </asp:ObjectDataSource>
    <br />


    <h3>
        New Shipment</h3>
    <p>
    </p>
    
        <table style="text-align: left;" width="100%" >
            <tr>
                <td style="width: 1377px; height: 12px; text-align: right;">
                    Shipment Date</td>
                <td style="width: 1169px; height: 12px; text-align: left;">
                    <asp:TextBox ID="txtShipmentDate" runat="server" Width="120px"></asp:TextBox>
                    <asp:CompareValidator ID="CompareValidator1" runat="server" ControlToValidate="txtShipmentDate"
                        ErrorMessage="*" Operator="DataTypeCheck" Type="Date"></asp:CompareValidator>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="txtShipmentDate"
                        ErrorMessage="*"></asp:RequiredFieldValidator></td>
                <td colspan="2" style="height: 12px; text-align: center">
                    <strong>Origin Details</strong></td>
                <td colspan="2" style="height: 12px; text-align: center">
                    <strong>
                    Destination Details</strong></td>
                   
            </tr>
            <tr>
                <td style="width: 1377px; height: 7px; text-align: right">
                    Shipment Number</td>
                <td style="width: 1169px; height: 7px; text-align: left">
                    <asp:TextBox ID="txtShipmentNumber" runat="server" Width="120px"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtShipmentNumber"
                        ErrorMessage="*"></asp:RequiredFieldValidator></td>
                <td style="width: 1146px; height: 7px; text-align: right">
                    Address</td>
                <td style="width: 12px; height: 7px; text-align: left">
                                <asp:TextBox ID="txtOriginAddress" runat="server" Width="120px"></asp:TextBox></td>
                <td style="width: 774px; height: 7px; text-align: right">
                    Address</td>
                <td style="width: 455px; height: 7px; text-align: left">
                    <asp:TextBox ID="txtDestinationAddress" runat="server" Width="120px"></asp:TextBox><asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtDestinationAddress"
                        ErrorMessage="*"></asp:RequiredFieldValidator></td>
            </tr>
            <tr>
                <td style="width: 1377px; height: 1px; text-align: right;">
                    Service type</td>
                <td style="width: 1169px; height: 1px; text-align: left;">
                    <asp:DropDownList ID="ddlServiceTypeID" runat="server" Width="128px" DataSourceID="ServiceTypeSource" DataTextField="ServiceTypeName" DataValueField="ServiceTypeID">
                    </asp:DropDownList></td>
                <td style="width: 1146px; height: 1px; text-align: right">
                    City</td>
                <td style="width: 12px; height: 1px; text-align: left">
                                <asp:DropDownList ID="ddlOriginCity" runat="server" Width="128px" DataSourceID="LocationDataSource" DataTextField="City" DataValueField="RateLocationID">
                                </asp:DropDownList></td>
                <td style="width: 774px; height: 1px; text-align: right">
                    City</td>
                <td style="width: 455px; height: 1px; text-align: left">
                                <asp:DropDownList ID="ddlDestinationRateLocation" runat="server" Width="128px" DataSourceID="LocationDataSource" DataTextField="City" DataValueField="RateLocationID">
                                </asp:DropDownList></td>
            </tr>
            <tr>
                <td style="width: 1377px; text-align: right">
                    Surcharges
                </td>
                <td style="width: 1169px; text-align: left">
                    <asp:DropDownList ID="ddlSurcharge" runat="server" DataSourceID="Surcharges" DataTextField="SurchargeName"
                        DataValueField="SurchargeID" Width="128px">
                    </asp:DropDownList>
                </td>
                <td style="width: 1146px; text-align: right">
                    Postal Code</td>
                <td style="width: 12px; text-align: left">
                                <asp:TextBox ID="txtOriginpostalCode" runat="server" Width="120px"></asp:TextBox></td>
                <td style="width: 774px; text-align: right">
                    Postal Code</td>
                <td style="width: 455px; text-align: left">
                    <asp:TextBox ID="txtDestinationPostalCode" runat="server" Width="120px"></asp:TextBox><asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtDestinationPostalCode"
                        ErrorMessage="*"></asp:RequiredFieldValidator></td>
            </tr>
            <tr>
                <td colspan="6" rowspan="4" style="height: 74px; text-align: left">
                    <strong>
                    Description<br />
                        <asp:TextBox ID="txtDescription" runat="server" Height="43px" Width="100%"></asp:TextBox></strong></td>
            </tr>
            <tr>
            </tr>
            <tr>
            </tr>
            <tr>
            </tr>
            <tr>
                <td colspan="6" style="height: 22px; text-align: center">
                    <asp:LinkButton ID="lnkbtnCreateShipment" runat="server" Font-Bold="True">Create New Shipment</asp:LinkButton></td>
            </tr>
            <tr>
                <td colspan="6" style="height: 1px; text-align: left">
                    <asp:Label ID="lblMessage" runat="server"></asp:Label></td>
            </tr>
            
        </table>
    <asp:ObjectDataSource ID="CarrierdataSource" runat="server" OldValuesParameterFormatString="original_{0}"
        SelectMethod="getCarrierByClientBranchId" TypeName="GTSSystem.BLL.Carrier">
        <SelectParameters>
            <asp:ProfileParameter Name="BranchID" PropertyName="BranchId" Type="Int32" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="LocationDataSource" runat="server" InsertMethod="AddRateLocation"
        OldValuesParameterFormatString="original_{0}" SelectMethod="GetRateLocation"
        TypeName="GTSSystem.BLL.RateLocation" UpdateMethod="UpdateRateLocation">
        <UpdateParameters>
            <asp:Parameter Name="RateLocationID" Type="Int32" />
            <asp:Parameter Name="City" Type="String" />
            <asp:Parameter Name="Province" Type="String" />
            <asp:Parameter Name="Country" Type="String" />
        </UpdateParameters>
        <SelectParameters>
            <asp:ProfileParameter Name="BranchID" PropertyName="BranchId" Type="Int32" />
        </SelectParameters>
        <InsertParameters>
            <asp:Parameter Name="BranchID" Type="Int32" />
            <asp:Parameter Name="City" Type="String" />
            <asp:Parameter Name="Province" Type="String" />
            <asp:Parameter Name="Country" Type="String" />
        </InsertParameters>
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="ServiceTypeSource" runat="server" OldValuesParameterFormatString="original_{0}"
        SelectMethod="GetServiceType" TypeName="GTSSystem.BLL.ServiceType"></asp:ObjectDataSource>
    <asp:ObjectDataSource ID="Surcharges" runat="server" OldValuesParameterFormatString="original_{0}"
        SelectMethod="GetSurcharge" TypeName="GTSSystem.BLL.Surcharge"></asp:ObjectDataSource>
   
</asp:Content>

